package com.naiterui.ehp.bs.cms.modules.wms.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.security.annotation.SysLog;
import com.naiterui.ehp.bs.cms.modules.wms.entity.Classification;
import com.naiterui.ehp.bs.cms.modules.wms.service.IClassificationService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 * 药理分类
 */
@Slf4j
@RestController
@Api(tags = {SwaggerTag.CMS + SwaggerTag.MEDICINE_DRUG})
@RequestMapping("wms/classification")
public class ClassificationController {

  @Autowired
  private IClassificationService categoryService;

  @SysLog("药理分类")
  @ApiOperation(value = "药理分类")
  @GetMapping("/pharmacology/list")
  @PreAuthorize("@p.check('wms:category:pharmacology:list')")
  public List<Classification> pharmacology() {
    return this.categoryService.getList(1);
  }

  @SysLog("药剂分类")
  @ApiOperation(value = "药剂分类")
  @GetMapping("/agents/list")
  @PreAuthorize("@p.check('wms:category:agents:list')")
  public List<Classification> agents() {
    return this.categoryService.getList(2);
  }

  @SysLog("药品分类")
  @ApiOperation(value = "药品分类")
  @GetMapping("/drug/list")
  @PreAuthorize("@p.check('wms:category:drug:list')")
  public List<Classification> drug() {
    return this.categoryService.getList(3);
  }

}
